﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EmployeeLeaveSystem.Shared.Models {
    public class StaffInfo {
        public int Id { get; set; }
        [Required]
        public string Name { get; set; } = "";
        public string Description { get; set; } = "";
        public StaffType Type { get; set; } = StaffType.Normal;
        //上级关系
        [ForeignKey(nameof(UpperStaffId))]
        public int? UpperStaffId { get; set; }
        public StaffInfo? UpperStaff { get; set; } = null; // 上级关系对应，可为空
        // 部门
        public int? DepartmentId { get; set; }
        public Department? Department { get; set; } // 员工所属的部门
        // 密码
        [Required]
        [MinLength(5)]
        public String Password { get; set; } = "";
        public StaffSex StaffSex { get; set; } = 0;
        public StaffState StaffState { get; set; } = 0;
        public String Nation { get; set; } = "";
        public String Political_Status { get; set; } = ""; // 政治面貌
        public String ID_Card { get; set; } = "";
        public String Phone_Number { get; set; } = "";
        public String Avatar_Name { get; set; } = "Ubuntu-32x32.png";

        // =================FOREIGN KEY================
        // 所属的员工信息
        public List<StaffInfo> childStaffs { get; set; } = new();
        // 申请人的请假信息记录
        public List<LeaveDetail> LeaveDetail { get; set; } = new();
        //审核人历史记录
        public List<LeaveDetail> AcceptHistory { get; set; } = new();
        // 申请部门调动记录
        public List<AddMoveDepartment> AddMoveDepartments { get; set; } = new();
        public List<AddRetireMove> AddRetireMoves { get; set; } = new();
        //申请加班认定
        public List<AddWOM> AddWOMs { get; set; } = new();
        // 薪水记录
        public List<SalaryInfo> salaryInfos { get; set; } = new();
    }
    public enum StaffType {
        [Display(Name="普通用户")]
        Normal = 0,
        [Display(Name = "管理员")]
        Manager = 1 }
    public enum StaffSex { Man = 0, WoMan = 1 }
    public enum StaffState { UnSet = 0, InService = 1, PartTimeJob = 2, OnTrial = 3, Quit = 4, Returnment = 5, Retire = 6 } // 受到调度影响
}
